
#include <BFont>
#include <BStyle>
#include "member_BLabel.h"

using namespace BWE;

member_BLabel::member_BLabel(BLabel* label)
{
	boss = label;
	align = Align_VCenter;
	boss->setSizePolicy(Policy_Dynamic, Policy_Dynamic);
	boss->setBorder(0);
	boss->setSizeStretch(0.1f, 0.1f);
}
member_BLabel::~member_BLabel()
{

}

void member_BLabel::freshRects()
{
	const BRect& crect = boss->clientRect();

	const BStyle* style = boss->realStyle();
	if (style)
		style->trans(text, t_text);
	else
		t_text.clear();

	const BFont* font = boss->font();
	if (font)
	{
		if (t_text.size())
			textSize = font->textSize(t_text);
		else
			textSize = font->textSize(text);
	}
	textRect = crect.align(align, textSize);
}
